//
//  LevelScreen.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/8/8.
//
//

#include "LevelScreen.h"

LevelScreen::LevelScreen()
{
    
}


Scene *LevelScreen::createScene(int level)
{
    auto scene = Scene::create();
    auto layer = LevelScreen::create(level);
    scene->addChild(layer);
    return scene;
}

LevelScreen* LevelScreen::create(int level)
{
    LevelScreen *pRet = new(std::nothrow) LevelScreen();
    if (pRet && pRet->init(level)){
        pRet->baseInit();
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }
}

bool LevelScreen::init(int level)
{
    m_level = level;
    monsterType = LevelScreenConfig::getMonsterType(level);
    PlayLevelRecorder::getInstance()->setNowPlayLevel(level);
    bad_matrix = LevelScreenConfig::getBadStateMatrix(level);
    bad_matrixUp = LevelScreenConfig::getBadUpStateMatrix(level);
    jelly_Matrix = LevelScreenConfig::getJellyMatrix(level);
    m_bombNum = LevelScreenConfig::getBombNum(level);
    bad_matrixProtectCover = LevelScreenConfig::getProtectCoverMatrix(level);
    bad_matrixBlank = LevelScreenConfig::getBlankMatrix(level);
    return true;
}
